{% load disqus_tags %}
<div class="mdl-grid mdl-shadow--2dp post_detail mdl-cell--11-col">
<a href="#" class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect" onclick="disqus();return false;"><i class="material-icons">comment</i>
</a>
<div id="disqus_thread" class="mdl-layout__content ">
</div>

{% disqus_sso_script %}
<script>
var disqus_developer = '{{ settings.DEV_SERVER }}' == 'True';
var disqus_url = 'http{% if request.is_secure %}s{% endif %}://{{ request.META.HTTP_HOST }}{{ object_for_comments.get_absolute_url }}';
var disqus_title = '{{ object_for_comments|escapejs }}';
var disqus_identifier = '{% disqus_id_for object_for_comments %}';
var disqus_loaded = false;

function disqus() {
	if (!disqus_loaded) {
		var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
		dsq.src = '//{{ settings.COMMENTS_DISQUS_SHORTNAME }}.disqus.com/embed.js';
		(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
	}
}

window.onscroll = function (e) {
    if ((window.innerHeight + window.scrollY)
        >= document.body.offsetHeight) {
        if (!disqus_loaded) disqus();
    }
};
</script>
</div>
